package com.kcsoft.mapper;

import com.kcsoft.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Insert("insert into dxai.user (username, password, create_time) VALUES (#{username}, #{password}, now())")
    void add(String username, String password);

    User findByUsername(String username);

    @Update("update dxai.user set username=#{username},password=#{password},stu_id=#{stuId},name=#{name},class_id=#{classId}, role=#{role} where id=#{id}")
    void update(User user);

    @Select("select * from dxai.user where id=#{id}")
    User findById(Integer userId);
}
